<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>具名插槽的使用</title>
</head>
<body>
  <div id="app">
    <!-- 替换指定名字的插槽 -->
    <cpn><span slot="center">标题1</span></cpn>
    <cpn><span slot="left">标题2</span></cpn>
    <cpn><button slot="left">标题3</button></cpn>
    <cpn></cpn>
  </div>
  <template id="cpn">
    <div>
      <slot name="left"><span>左边</span></slot>
      <slot name="center"><span>中间</span></slot>
      <slot name="right"><span>右边</span></slot>
      <slot>没有名字将被替换</slot>
    </div>
  </template>
  <script src="../js/vue.js"></script>
  <script>
    const app = new Vue({
      el:'#app',
      components:{
        cpn:{
          template:'#cpn'
        }
      }
    })
  </script>
</body>
</html>